package com.ehotting.edsta.diagnosisPredict.controller;

import com.ehotting.eaf.core.domain.R;
import com.ehotting.eaf.core.web.controller.BaseController;
import com.ehotting.eaf.core.web.domain.diagnosisPredict.PageDto;
import com.ehotting.edsta.diagnosisPredict.domain.dto.FeLine;
import com.ehotting.edsta.diagnosisPredict.feign.FeLineFeignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "FeLineController",description = "算子连接线段接口")
@RestController
@RequestMapping("/feLine")
public class FeLineController extends BaseController {

    @Autowired
    private FeLineFeignService lineFeignService;


    /**
     * 根据id批量删除,逗号分隔ps:'1,2,3”，关联子表删除请重写
     * @return
     */
    @ApiOperation(value = "根据id批量删除,逗号分隔ps:'1,2,3”，关联子表删除请重写",notes = "")
    @PostMapping(value = "/deLeteByIds")
    public R<String> deLeteByIds(String ids){
        return R.convert(lineFeignService.deLeteByIds(ids));
    }

    /**
     * 根据id查询
     * @return
     */
    @ApiOperation(value = "根据id查询",notes = "返回的数据类型：FeLine")
    @GetMapping(value = "/getById")
    public R<FeLine> getById(Long id){
        return R.convert(lineFeignService.getById(id));
    }

    /**
     * 列表
     * @return
     */
    @ApiOperation(value = "列表",notes = "返回的数据类型：List\\<FeLine\\>")
    @GetMapping(value = "/list")
    public R<List<FeLine>> list(Long canvasId, Long cid, String createTime, Long id, String lineParams, Long pid){
        return R.convert(lineFeignService.list(canvasId, cid, createTime, id, lineParams,pid));
    }

    /**
     * 分页列表
     * @return
     */
    @ApiOperation(value = "分页列表",notes = "返回的数据类型：PageDto\\<FeLine\\>")
    @GetMapping(value = "/pageList")
    public R<PageDto<FeLine>> pageList(Long canvasId, Long cid, String createTime, Long id, String lineParams, Long pid){
        return R.convert(lineFeignService.pageList(canvasId, cid, createTime, id, lineParams,pid));
    }

    /**
     * 保存
     * @return
     */
    @ApiOperation(value = "保存",notes = "返回的数据类型：FeLine")
    @PostMapping(value = "/save")
    public R<FeLine> save(@RequestBody FeLine feLine){
        return R.convert(lineFeignService.save(feLine));
    }

    /**
     * 根据数据的id修改或不存在id就添加
     * @return
     */
    @ApiOperation(value = "根据数据的id修改或不存在id就添加",notes = "")
    @PostMapping(value = "/saveOrUpdate")
    public R<String> saveOrUpdate(@RequestBody FeLine feLine){
        return R.convert(lineFeignService.saveOrUpdate(feLine));
    }

    /**
     * 根据数据的id批量修改或不存在id就批量添加
     * @return
     */
    @ApiOperation(value = "根据数据的id批量修改或不存在id就批量添加",notes = "")
    @PostMapping(value = "/saveOrUpdateBatch")
    public R<String> saveOrUpdateBatch(@RequestBody FeLine[] feLine){
        return R.convert(lineFeignService.saveOrUpdateBatch(feLine));
    }

    /**
     * 修改
     * @return
     */
    @ApiOperation(value = "修改",notes = "")
    @PostMapping(value = "/update")
    public R<String> update(@RequestBody FeLine feLine){
        return R.convert(lineFeignService.update(feLine));
    }

    /**
     * 根据数据的id批量修改
     * @return
     */
    @ApiOperation(value = "根据数据的id批量修改",notes = "")
    @PostMapping(value = "/updateList")
    public R<String> updateList(@RequestBody FeLine[] feLine){
        return R.convert(lineFeignService.updateList(feLine));
    }

}
